package com.edu.bcht.test01.mapper;

import com.edu.bcht.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

//@Component
@CacheConfig(cacheNames = "baseCache")
public interface User01Mapper {

    @Insert("insert INTO `user`(id,name,age)values(#{id},#{name},#{age})")
    public  void insert(@Param("id") Integer id, @Param("name") String name, @Param("age") String age);

    @Select("select * from user")
    @Cacheable
    List<User> getAll();
}
